package com.achao.controller;

import com.achao.beans.dto.Result;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;

/**
 * @Author: achao
 * @DateTime: 2022/10/14 17:46
 * @Description: TODO
 */

@RestController
@RequestMapping("/user")
public class UserController {

    @GetMapping(value = "/name/{name}")
    public String name(@PathVariable String name) {
        return name;
    }

    @GetMapping("/hello")
    public String hello(HttpServletRequest request){
        String token = request.getHeader("token");
        return "hello"+token;
    }

    @GetMapping("/result")
    public Result result(){
        return Result.success("我是统一结果集");
    }

}
